<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>席位成交明细表</title>
    <!--导入layui包-->
    <link rel="stylesheet" href="../layui/css/layui.css"/>
    <script src="../jQuery/jquery-1.11.2.js"></script>
    <script src="../layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/font.css">
</head>
<body>
<blockquote class="layui-elem-quote news_search">
<!--数据表格-->
<table class="layui-hide" id="DayStatement" lay-filter="secStockList"></table>

<script type="text/html" id="day_search">
    <!--多条件查询层-->
    <div class="layui-inline">
        券商编号:
        <div class="layui-input-inline">
            <select name="seatId" id="seatId"></select>
        </div>
        <button id="search" class="layui-btn  layui-btn-primary layui-bg-gray" lay-submit data-type="reload"
                lay-filter="provinceSearch">
            <i class="layui-icon">&#xe615;</i>
        </button>
    </div>
    <!--多条件查询结束-->
</script>

<!-- 行中操作按钮[仅对本行操作] -->

<!--脚本代码-->
<script type="text/javascript">
    layui.use(['table', 'layer', 'form', 'laypage', 'util', 'jquery'], function () {
        //导入模块并得到模块对象
        var table = layui.table,//表格对象
            layer = layui.layer,//弹层对象
            form = layui.form,//表单对象
            laypage = layui.laypage,//分页组件
            $ = layui.jquery,//jquery对象
            util = layui.util;//工具对象
        var tables;
        var vals="";
        var varseName="<option value=''>--请选择--</option>";
        //开关用于避免重复添加搜索框
        var tufa=false;
        //开关用于避免重复执行
        var tafa=true;
        var two;
        //渲染表格对象
        tables=table.render({
            //id:"houseReload",//为多条件搜索重新加载使用
            elem: "#DayStatement",//表格对象
            url: "/SeateMX/seatmx",//后台服务路径
            method: "get",//提交方式
            height: 1100,
            toolbar: "#day_search",//表格上方普通工具栏
            //一页显示5条数据
            limit: 5,
            cols: [
                [
                    {field: "seatId", title: "券商席位", align: "center"},
                    {field: "buyshares", title: "买入股票（支）", align: "center"},
                    {field: "soldshares", title: "卖出股票（支）", align: "center"},
                    {field: "buybond", title: "买入债券（支）", align: "center"},
                    {field: "soldbond", title: "卖出债券（支）", align: "center"},
                    {field: "totalMoney", title: "金额合计（元）", align: "center"},
                    {field: "tranDate", title: "交易日期", align: "center"}
                ]
            ],parseData:function (res) {
                var datasTwo = new Array();
                //证券
                two = res.trading;
                var twoStr = "<option value=''>--请选择--</option>";
                for (var i = 0; i < two.length; i++) {
                    twoStr += "<option value='" + two[i].seatId + "'>" + two[i].seatId + "</option>";
                }
                $("#seatId").html(twoStr);
                for (var i = 0; i < res.data.length; i++) {
                    if (vals == "") {
                        datasTwo.push(res.data[i]);
                    } else if (res.data[i].seatId === vals) {
                        datasTwo.push(res.data[i]);
                    }
                }
                return {
                    "code": res.code,
                    "msg": res.msg,
                    "count": datasTwo.length,
                    "data": datasTwo
                }
            },
            page: true,
            //一页选择显示5或10条数据
            limits: [5, 10]
        });
        form.on("submit(provinceSearch)",function (data) {
            vals=data.field.seatId;
            /* //定义表单数据对象
             var formData=data.field;
             //得到表单数据json字符串
             var json=JSON.stringify(data.field);*/
            //alert(json);
            //重新加载表格对象
            tables.reload("secStockList");
            /*return false;*/
        });
    });
</script>
</blockquote>
</body>
</html>